----------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\Public\Documents\Old\Lavoro Gregory\Antras_stime.log
  log type:  text
 opened on:   3 Sep 2013, 16:04:39

. 
. use "Calcoli\Final_database_extensive_JIE.dta", clear

. 
. sort siren

. 
. merge siren using Calcoli\Selection_firm_JIE.dta
(note: you are using old merge syntax; see [D] merge for new syntax)
variable siren does not uniquely identify observations in the master data

. drop _merge

. rename IM_firm IM

. replace  IM=0 if  IM==.
(962463 real changes made)

. keep if EIIG==1 | champ_theorique==0 
(104145 observations deleted)

. sort siren

. merge siren using "Calcoli\random_no_EIIG_champs_theorique_JIE.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variable siren does not uniquely identify observations in the master data

. keep if EIIG==1 | champ_theorique==0 &  random_no_EIIG_champs_theorique==1
(755829 observations deleted)

. 
. save Calcoli\temp_Antras_JIE.dta, replace
file Calcoli\temp_Antras_JIE.dta saved

. 
. 
. ***********Country analysis*******************
. 
. use Calcoli\temp_Antras_JIE.dta, clear

. 
. gen intra_value=0

. replace intra_value=val if  intra_firm==1
(23731 real changes made)

. 
. gen outs_value=0

. replace outs_value=val if  intra_firm==0
(257223 real changes made)

. 
. collapse (sum) intra_value outs_value, by(pays)

. gen tot= intra_value+ outs_value

. 
. gen share_intra= intra_value/ tot
(1 missing value generated)

. 
. replace pays="ZR" if pays=="CD"
(0 real changes made)

. sort  pays

. merge pays using "Calcoli\country_of_origin_variables.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)

. drop if _merge==2
(20 observations deleted)

. drop _merge

. 
. 
. local instruct "tex tdec(4) rdec(4) auto(4) bdec(4) sdec(4) symbol($^a$,$^b$,$^c$)  se"

. 
. *gen ln_distw=log(distw)
. gen ln_pop=log(pop)
(45 missing values generated)

. xi: regress  share_intra  ln_kl ln_hl  ln_pop

      Source |       SS       df       MS              Number of obs =     112
-------------+------------------------------           F(  3,   108) =    8.66
       Model |  .962869052     3  .320956351           Prob > F      =  0.0000
    Residual |  4.00437989   108  .037077592           R-squared     =  0.1938
-------------+------------------------------           Adj R-squared =  0.1715
       Total |  4.96724895   111  .044749991           Root MSE      =  .19256

------------------------------------------------------------------------------
 share_intra |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       ln_kl |   .0425722   .0190685     2.23   0.028     .0047752    .0803693
       ln_hl |   .0854759   .1014494     0.84   0.401    -.1156144    .2865662
      ln_pop |    .017761   .0111402     1.59   0.114    -.0043207    .0398428
       _cons |  -.2888735   .1399609    -2.06   0.041    -.5663002   -.0114467
------------------------------------------------------------------------------

. outreg2  ln_kl ln_hl  ln_pop using Antras.xls, ctitle(country) `instruct' replace
Antras.tex
Antras.xls
dir : seeout

. 
. ***********Industry analysis*******************
. 
. use Calcoli\temp_Antras_JIE.dta, clear

. 
. gen intra_value=0

. replace intra_value=val if  intra_firm==1
(23731 real changes made)

. 
. gen outs_value=0

. replace outs_value=val if  intra_firm==0
(257223 real changes made)

. 
. collapse (sum) intra_value outs_value, by(nace_rev1)

. gen tot= intra_value+ outs_value

. 
. gen share_intra= intra_value/ tot

. 
. sort  nace_rev1

. 
. merge  nace_rev1 using  "Calcoli\final_product_variables.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)

. drop _merge

. 
. gen contractibility=1-frac_lib_diff_prod_4dig
(193 missing values generated)

. gen ln_capit_intens_nace_rev1_3dig=log(capit_intens_nace_rev1_3dig) 
(173 missing values generated)

. gen ln_w_bas_skills_nace_rev1_3dig=log(w_bas_skills_nace_rev1_3dig)
(173 missing values generated)

. 
. 
. local instruct "tex tdec(4) rdec(4) auto(4) bdec(4) sdec(4) symbol($^a$,$^b$,$^c$)  se"

. 
. xi: regress  share_intra  ln_capit_intens_nace_rev1_3dig ln_w_bas_skills_nace_rev1_3dig contractibility

      Source |       SS       df       MS              Number of obs =     215
-------------+------------------------------           F(  3,   211) =    7.61
       Model |  1.26843003     3   .42281001           Prob > F      =  0.0001
    Residual |  11.7228956   211  .055558747           R-squared     =  0.0976
-------------+------------------------------           Adj R-squared =  0.0848
       Total |  12.9913257   214  .060707129           Root MSE      =  .23571

------------------------------------------------------------------------------------------------
                   share_intra |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------------------------+----------------------------------------------------------------
ln_capit_intens_nace_rev1_3dig |   .0543338   .0303563     1.79   0.075    -.0055066    .1141743
ln_w_bas_skills_nace_rev1_3dig |   .2360797   .0905088     2.61   0.010     .0576622    .4144971
               contractibility |  -.1283255   .0420133    -3.05   0.003    -.2111451   -.0455058
                         _cons |  -.6189497    .251252    -2.46   0.015    -1.114235   -.1236641
------------------------------------------------------------------------------------------------

. outreg2 ln_capit_intens_nace_rev1_3dig ln_w_bas_skills_nace_rev1_3dig contractibility using Antras.xls, ctitle(indus
> try) `instruct' append
Antras.tex
Antras.xls
dir : seeout

. 
. 
. 
. ******************************Bernard********************************************
. 
. 
. use "Calcoli\Final_database_extensive_JIE.dta", clear

. 
. sort siren

. 
. merge siren using Calcoli\Selection_firm_JIE.dta
(note: you are using old merge syntax; see [D] merge for new syntax)
variable siren does not uniquely identify observations in the master data

. drop _merge

. rename IM_firm IM

. replace  IM=0 if  IM==.
(962463 real changes made)

. keep if EIIG==1 | champ_theorique==0 
(104145 observations deleted)

. sort siren

. merge siren using "Calcoli\random_no_EIIG_champs_theorique_JIE.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variable siren does not uniquely identify observations in the master data

. keep if EIIG==1 | champ_theorique==0 &  random_no_EIIG_champs_theorique==1
(755829 observations deleted)

. 
. ***********************************
. 
. gen intra_value=0

. replace intra_value=val if  intra_firm==1
(23731 real changes made)

. 
. gen outs_value=0

. replace outs_value=val if  intra_firm==0
(257223 real changes made)

. 
. collapse (sum) intra_value outs_value, by(pays cpa_4)

. 
. 
. gen tot= intra_value+ outs_value

. 
. gen share_intra= intra_value/ tot
(6 missing values generated)

. 
. sort   cpa_4

. 
. merge cpa_4 using  "Calcoli\imported_product_variables.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variable cpa_4 does not uniquely identify observations in the master data
variable cpa_4 does not uniquely identify observations in Calcoli\imported_product_variables.dta

. 
. keep if _merge==3
(553 observations deleted)

. 
. drop _merge

. 
. *sort  nace_rev1
. 
. *merge nace_rev1 using  "Calcoli\final_product_variables.dta"
. 
. *keep if _merge==3
. 
. *drop _merge
. 
. 
. replace pays="ZR" if pays=="CD"
(0 real changes made)

. 
. sort  pays

. 
. merge pays using "Calcoli\country_of_origin_variables.dta"
(note: you are using old merge syntax; see [D] merge for new syntax)
variable pays does not uniquely identify observations in the master data

. 
. drop if _merge==2
(21 observations deleted)

. 
. drop _merge

. 
. gen ln_distw=log(distw)
(453 missing values generated)

. gen ln_pop=log(pop)
(989 missing values generated)

. 
. gen contr_orig1=(1-frac_lib_diff_orig)

. gen ln_capital_intensity_cpa_4=log( capital_intensity_cpa_4)
(1149 missing values generated)

. gen ln_skill_intensity_cpa_4=log( skill_intensity_cpa_4)
(1149 missing values generated)

. 
. 
. gen pippo=0

. 
. replace pippo=1 if  share_intra>0
(3714 real changes made)

. local instruct "tex tdec(4) rdec(4) auto(4) bdec(4) sdec(4) symbol($^a$,$^b$,$^c$)  se"

. 
. 
. probit pippo ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French_speaking
>  French_colony legor_fr ln_pop, robust

Iteration 0:   log pseudolikelihood = -5119.9372  
Iteration 1:   log pseudolikelihood = -4043.3093  
Iteration 2:   log pseudolikelihood = -4026.5855  
Iteration 3:   log pseudolikelihood = -4026.5761  
Iteration 4:   log pseudolikelihood = -4026.5761  

Probit regression                                 Number of obs   =       7502
                                                  Wald chi2(11)   =    1468.99
                                                  Prob > chi2     =     0.0000
Log pseudolikelihood = -4026.5761                 Pseudo R2       =     0.2135

--------------------------------------------------------------------------------------------
                           |               Robust
                     pippo |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------------------+----------------------------------------------------------------
ln_capital_intensity_cpa_4 |   -.017376    .029027    -0.60   0.549    -.0742678    .0395159
  ln_skill_intensity_cpa_4 |   .4270167   .0860408     4.96   0.000     .2583797    .5956536
               contr_orig1 |  -.2226605   .0458556    -4.86   0.000    -.3125358   -.1327852
                     ln_kl |   .1358641   .0331907     4.09   0.000     .0708116    .2009166
                     ln_hl |   .3760563   .1174954     3.20   0.001     .1457695    .6063431
                        Qc |   1.999267   .1704649    11.73   0.000     1.665162    2.333372
                  ln_distw |  -.3363783   .0189662   -17.74   0.000    -.3735512   -.2992053
           French_speaking |  -.1845969   .0570626    -3.23   0.001    -.2964376   -.0727562
             French_colony |  -.0637796   .0632188    -1.01   0.313    -.1876861    .0601269
                  legor_fr |   .3322289   .0447079     7.43   0.000     .2446029    .4198548
                    ln_pop |   .2935187   .0137046    21.42   0.000     .2666582    .3203792
                     _cons |  -2.837684    .405453    -7.00   0.000    -3.632358   -2.043011
--------------------------------------------------------------------------------------------

. mfx , var(ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French_speaking Fr
> ench_colony legor_fr ln_pop)

Marginal effects after probit
      y  = Pr(pippo) (predict)
         =  .40139402
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
ln_cap~4 |  -.0067192      .01122   -0.60   0.549  -.028718   .01528   4.06367
ln_ski~4 |   .1651244      .03324    4.97   0.000   .099972  .230277   3.15602
contr_~1 |  -.0861013      .01772   -4.86   0.000  -.120833 -.051369   .314389
   ln_kl |   .0525377       .0128    4.10   0.000   .027447  .077629   10.2204
   ln_hl |   .1454184      .04545    3.20   0.001   .056336  .234501   .784402
      Qc |   .7731028      .06596   11.72   0.000   .643821  .902385   .684594
ln_distw |  -.1300752      .00732  -17.76   0.000  -.144427 -.115723   7.99406
French~g*|  -.0701379      .02123   -3.30   0.001  -.111753 -.028523   .183418
French~y*|  -.0245097      .02413   -1.02   0.310  -.071798  .022778   .134897
legor_fr*|   .1287891      .01729    7.45   0.000   .094896  .162682   .412423
  ln_pop |   .1135017      .00522   21.76   0.000    .10328  .123723   3.14496
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1

. outreg2 ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French_speaking Fren
> ch_colony legor_fr ln_pop  using Bernard.xls, ctitle(1st stage) `instruct' replace
Bernard.tex
Bernard.xls
dir : seeout

. 
. predict linp, xb                                        //linear prediction
(3862 missing values generated)

. gen  IM = normalden(linp) / normal(linp)                //inverse Mills' ratio
(3862 missing values generated)

. 
. regress  share_intra  ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French
> _speaking IM if share_intra>0, robust

Linear regression                                      Number of obs =    3202
                                                       F(  9,  3192) =   34.77
                                                       Prob > F      =  0.0000
                                                       R-squared     =  0.0944
                                                       Root MSE      =  .31313

--------------------------------------------------------------------------------------------
                           |               Robust
               share_intra |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------------+----------------------------------------------------------------
ln_capital_intensity_cpa_4 |   .0581607   .0106594     5.46   0.000     .0372607    .0790607
  ln_skill_intensity_cpa_4 |   .2706774   .0303562     8.92   0.000     .2111578     .330197
               contr_orig1 |  -.1527431    .016549    -9.23   0.000    -.1851908   -.1202954
                     ln_kl |   .0631999   .0129037     4.90   0.000     .0378996    .0885003
                     ln_hl |   .0061872    .040156     0.15   0.878    -.0725469    .0849213
                        Qc |  -.1057393   .0673604    -1.57   0.117    -.2378133    .0263347
                  ln_distw |  -.0287773   .0079932    -3.60   0.000    -.0444497   -.0131049
           French_speaking |  -.0519608   .0181323    -2.87   0.004     -.087513   -.0164086
                        IM |   .2689232   .0252556    10.65   0.000     .2194043     .318442
                     _cons |  -1.229812   .1541595    -7.98   0.000    -1.532074   -.9275507
--------------------------------------------------------------------------------------------

. outreg2 ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French_speaking IM  
> using Bernard.xls, ctitle(2nd stage) `instruct' append
Bernard.tex
Bernard.xls
dir : seeout

. 
. 
. *xi: heckman  share_intra  ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw F
> rench_speaking , select(pippo= ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_dis
> tw French_speaking French_colony legor_fr ln_pop) twostep
. *outreg2 ln_capital_intensity_cpa_4 ln_skill_intensity_cpa_4 contr_orig1 ln_kl ln_hl Qc ln_distw French_speaking Fre
> nch_colony legor_fr ln_pop   using Bernard.xls, ctitle(bernard) `instruct' replace
. 
. log close
      name:  <unnamed>
       log:  C:\Users\Public\Documents\Old\Lavoro Gregory\Antras_stime.log
  log type:  text
 closed on:   3 Sep 2013, 16:05:08
----------------------------------------------------------------------------------------------------------------------
